package com.simtop.controller;

import com.simtop.common.ServerResponse;
import com.simtop.pojo.experimentpo.Echarts3;
import com.simtop.service.EchartsService;
import com.simtop.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @Author: liuzhaobo
 * @Description: 申报网站首页数据分析
 * @DateTime: 2022/8/31 0031 16:56
 * @Params:
 * @Return
 */
@RestController
@RequestMapping("/chart")
@CrossOrigin
public class ChartController {

    @Autowired
    private UserService userService;

    @Autowired
    private EchartsService echartsService;

    /**
     * @Author: liuzhaobo
     * @Description: 省级人数
     * @DateTime: 2022/10/12 0012 11:56
     * @Params:
     * @Return
     */
    @GetMapping("/topPage")
    public ServerResponse getTopPage() {
        try {
            return userService.getTopPageCount();
        } catch (Exception e) {
            return ServerResponse.createByErrorMsg("查询图表内容失败");
        }
    }

    /**
     * @Author: liuzhaobo
     * @Description: 分数统计
     * @DateTime: 2022/10/12 0012 11:57
     * @Params:
     * @Return
     */
    @RequestMapping(value = "/score", method = RequestMethod.GET)
    @ResponseBody
    public ServerResponse<Echarts3> selectScoreUser() {
        try {
            return echartsService.selectScoreUser();
        } catch (Exception e) {
            return ServerResponse.createByErrorMsg("查询成绩内容失败");
        }
    }


}
